package com.liu.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author LIU
 * @version 1.0
 * @description: TODO
 * @date 2023/6/18 12:49
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;



    @RequestMapping("/add/{id}")
    public String add(@PathVariable("id")String id){
        System.out.println("下单成功");
        String msg = restTemplate.getForObject("http://stock-server/stock/reduce", String.class);

        return  String.format("hello world  id:[ %s ],msg: %s", id, msg);
    }


}
